package com.newly.driver.sdk.device.video.constants;

/**
 * @author gjm guan
 * @date 2021/10/15 14:13
 * @desc 设备常量以及枚举数据
 */
public class DeviceConstant {

    /**
     * 直播流可用时间
     */
    public static final int STREAM_LIVE_EXPIRE_TIME = 36000;

    public enum DeviceFirm {
        DAHUA(1, "DAHUA", "大华"), IPC(2, "HAIKANG", "海康");

        DeviceFirm(int key, String value, String remark) {
            this.key = key;
            this.value = value;
            this.remark = remark;
        }

        DeviceFirm() {
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }

        public String getRemark() {
            return remark;
        }

        public void setKey(int key) {
            this.key = key;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        private int key;

        private String value;

        private String remark;
    }

    /**
     * 摄像头类型
     */
    public enum DeviceType {
        NVR(1, "NVR", "平台"), IPC(2, "IPC", "摄像头");

        DeviceType(int key, String value, String remark) {
            this.key = key;
            this.value = value;
            this.remark = remark;
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }

        public String getRemark() {
            return remark;
        }

        DeviceType() {
        }

        public void setKey(int key) {
            this.key = key;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public static DeviceType getInstance(int value) {
            for (DeviceType deviceType : DeviceType.values()) {
                if (deviceType.getKey() == value) {
                    return deviceType;
                }
            }
            return null;
        }

        private int key;

        private String value;

        private String remark;
    }

    /**
     * 协议类型
     */
    public enum DeviceProtocol {
        GB28181(1, "GB28181", "国标"), PRIVATE(2, "PRIVATE", "私有");

        DeviceProtocol(int key, String value, String remark) {
            this.key = key;
            this.value = value;
            this.remark = remark;
        }


        public static DeviceProtocol getInstance(int value) {
            for (DeviceProtocol deviceProtocol : DeviceProtocol.values()) {
                if (deviceProtocol.getKey() == value)
                    return deviceProtocol;
            }
            return null;
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }

        public String getRemark() {
            return remark;
        }

        private int key;

        private String value;

        /**
         * 备注
         */
        private String remark;
    }


    /**
     * 平台
     */
    public enum Platform {
        TENCENT(0, "tencent"),
        QINIU(1, "qiniu");

        Platform(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public int getKey() {
            return key;
        }

        public static Platform getInstance(String value) {
            for (Platform platform : Platform.values()) {
                if (platform.getValue().equals(value)) {
                    return platform;
                }
            }
            return null;
        }

        public String getValue() {
            return value;
        }

        private int key;
        private String value;

    }

    /**
     * 设备状态
     */
    public enum DeviceState {
        OFFLINE(0, "offline"), ONLINE(1, "online");

        DeviceState(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public static DeviceState getInstance(int key) {
            for (DeviceState value : DeviceState.values()) {
                if (value.key == key) {
                    return value;
                }
            }
            return null;
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }

        private int key;

        private String value;
    }

}
